package com.postracker.postracker.io;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

public class TextRowFile {

	private String fileName;

	public TextRowFile(String fileName) {
		this.fileName = fileName;
	}

	public List<String> getAllLines() throws IOException {
		URL resource = this.getClass().getResource("/" + fileName);
		File file = new File(resource.getPath());
		FileInputStream fstream = new FileInputStream(file);
		InputStreamReader inputStreamReader = new InputStreamReader(fstream);
		BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
		List<String> allLines = new ArrayList<String>();
		String strLine;
		while ((strLine = br.readLine()) != null) {
			allLines.add(strLine);
		}
		inputStreamReader.close();
		return allLines;
	}

}
